// 用koa搭建静态资源服务器
const Koa = require('koa')
const serve = require('koa-static')
const main = require('./src/main')
const schedule = require('node-schedule')
const path = require("node:path");

main();

// 每天凌晨4点钟定时任务执行main
schedule.scheduleJob('0 19 2 * * *', () => {
  main()
})

const app = new Koa()

app.use(serve(path.resolve(__dirname, './public')))


app.listen(4100)

console.log('server is running at http://localhost:4100')